﻿using System.Windows;

namespace WholeSlideImageViewer
{
    /// <summary>
    /// OptiOutputDialog.xaml 的交互逻辑
    /// </summary>
    public partial class OptiOutputDialog : Window
    {
        internal IOptiOutputOptions? OutputOptions { get; private set; }

        public OptiOutputDialog()
        {
            InitializeComponent();

            var viewModel = new OptiOutputDialogViewModel();
            viewModel.RequestConfirm += Confirm;
            viewModel.RequestCancel += Cancel;
            DataContext = viewModel;
        }

        private void Confirm(IOptiOutputOptions options)
        {
            DialogResult = true;
            OutputOptions = options;
            Close();
        }

        private void Cancel()
        {
            DialogResult = false;
            OutputOptions = null;
            Close();
        }

    }
}
